package nio.bytebuffer;

import java.nio.ByteBuffer;

public class AllocationDirect_JVM_GC {

    public static void main(String[] args) {

        System.out.println("A");
        ByteBuffer buffer = ByteBuffer. allocateDirect( Integer. MAX_VALUE);

        System.out.println("B");
        byte[] byteArray = new byte[] { 1 };
        System.out.println(Integer.MAX_VALUE);
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            buffer.put(byteArray);
        }

        System.out.println(" put end!");
        // 内存的释放由 GC 完成
    }

}
